﻿namespace QInfrastructure.Utils;

public static class DateTimeExtension
{
    public static bool IsDateTimeHasMillScend { get; set; }

    public static string ToDateTimeStr(this DateTime dateTime)
    {
        string text = (IsDateTimeHasMillScend ? "yyyy-MM-dd HH:mm:ss.fff" : "yyyy-MM-dd HH:mm:ss");
        return dateTime.ToString(text);
    }

    public static string ToDateStr(this DateTime dateTime)
    {
        return dateTime.ToString("yyyy-MM-dd");
    }
}